/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.faesa.acervo.util;

import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Eric Rosetti Lessa
 */
public class DataUtil {
    
    public static int compararDatasSemHora(Date dt1, Date dt2){
        dt1 = zerarHora(dt1);
        dt2 = zerarHora(dt2);
        
        return dt1.compareTo(dt2);
    }
    
    
    public static Date zerarHora(Date dt){
        
        Calendar calendar = Calendar.getInstance();
        
        calendar.setTime(dt);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        
        return calendar.getTime();
    }
}
